package amani.wechat.platform.services.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import amani.wechat.platform.services.ICommonService;
import amani.wechat.platform.services.IOrdersService;

@Service("OrdersService")
public class OrdersService implements IOrdersService{
	
	@Resource(name="CommonService")
	ICommonService commonService ;

	@Override
	public List<String> getOdersFactProject(String openId) {  
		List<String>  reusult=new ArrayList<String>();
		String jsonString=commonService.loadOrders(openId);
		net.sf.json.JSONArray array= net.sf.json.JSONArray.fromObject(jsonString);  
		for (int i = 0; i < array.size(); i++) {
			net.sf.json.JSONObject object=	(net.sf.json.JSONObject)array.get(i);
			String value=(String)object.get("orderfactproject");
			if(value!=null && !value.isEmpty()){
				if(!reusult.contains(value)){
					reusult.add(value);
				}
			}
		}
		return reusult;
	}

	@Override
	public boolean saveOrder(String strCompId, String strBillId,
			String strCardNo, String orderPhone, String strDate,
			String strTime, String openid, int billType, String complydetail) {
		// TODO Auto-generated method stub
		return commonService.saveOrders(strCompId, strBillId, strCardNo, orderPhone, strDate, strTime, openid, billType, complydetail);
		
	}

}
